package cn.com.zpark.servlet_request;

import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @PackageName: cn.com.zpark.servlet_request
 * @ClassName: ServletRequestDemo04
 * @Description:
 * @author: RZS
 * @date: 2021/11/13  16:11
 */
@WebServlet("/srd4.do")
public class ServletRequestDemo04 extends HttpServlet {
    @Override
    protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        // 练习转发

        /**
         * request.getRequestDispatcher()  获取转发器
         */
        // 获取转发器对象
        RequestDispatcher dispatcher = request.getRequestDispatcher("srd5.do");
        // 调用forward方法转发
        dispatcher.forward(request, response);
    }
}
